<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>课程详情</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <style>
        body{ background-color: #F6F7F8}
        header{
            background-color: black;
        }
        .flex{display: -webkit-box; display: -webkit-flex; display: flex;}
    </style>
</head>
<body>
<div id="wrap" class="flex-wrap flex-vertical">
    <header>

    </header>
    <div style="width: 100%; height: 2.10rem; background-color: black"></div>
    <div id="main" class="flex-con">

    </div>
</div>
</body>
</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common/common.js"></script>
<script type="text/javascript">
    var videoHeight, dw;
    apiready = function () {
        $api.fixStatusBar( $api.dom('header') );

        videoHeight = 210*(api.winWidth/375);
        dw = api.winWidth/375;

        api.openFrame({
            name: 'videoControlFrame',
            url: './videoControlFrame.html',
            bgColor: 'rgba(0,0,0,0)',
            bounces: false,
            rect: {
                x: 0,
                y: $api.dom('header').offsetHeight + (16*dw),
                w: api.winWidth,
                h: (30*dw),
            }
        });

        api.openFrame({
            name: 'videoFrame',
            url: './videoFrame.html',
            bgColor: 'rgba(0,0,0,0)',
            bounces: true,
            pageParam: {
                video_id: api.pageParam.video_id,
            },
            rect: {
                x: 0,
                y: $api.dom('header').offsetHeight + videoHeight,
                w: api.winWidth,
                h: $api.dom('#main').offsetHeight - videoHeight,
            }
        });
    }

    function playVideo(videoUrl, coverImg) {
        var moviePlayer = api.require('moviePlayer');
        moviePlayer.open({
            rect:{
                x: 0,
                y: $api.dom('header').offsetHeight,
                w:api.frameWidth,
                h:videoHeight
            },
            styles:{
                head:{
                    bg: 'rgba(0,0,0,0)',
                    height: 44,
                    y:20,
                    backSize: 30,
                    backImg:'widget://image/course/back-button.png',
                },
                foot:{
                    bg: 'rgba(0,0,0,0.27)',
                    height: 30,
                    palyBtn:{
                        size: 16,
                        playImg:'widget://image/course/play-icon.png',
                        pauseImg:'widget://image/course/pause-icon.png',
                        marginLeft:5
                    },
                    currentTimeLabel:{
                        textSize:14,
                        textColor:"#FFF",
                        textWidth: 43,
                        marginLeft:5
                    },
                    seekBar:{
                        sliderImg:'widget://image/course/circle-icon.png',
                        sliderW : 14,
                        sliderH : 14,
                        progressColor: 'rgba(255,255,255,0.50)',
                        progressSelected: '#ffffff',
                        marginLeft:10,
                        marginRight:10
                    },
                    totalTimeLabel:{
                        textSize:14,
                        textColor:"#FFF",
                        textWidth: 43,
                        marginRight:5
                    },
                    fullscreenBtn:{
                        size:16,
                        verticalImg:'widget://image/course/vertical-icon.png',
                        horizontalImg:'widget://image/course/horizontal-icon.png',
                    }
                }
            },
            path: videoUrl,
            coverImg: coverImg,
            autoPlay: true,
            showBack: false
        },function(ret, err){
            if(ret){
                // alert(JSON.stringify(ret));
                // } else {
                // alert(JSON.stringify(err));
            }

        });
        api.bringFrameToFront({
            from: 'controlFrame',
        });
    }
</script>
